package com.zl.aop.spring;

import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory;

/**
 * @author ZLL
 * @date create in 2018/05/09
 */
public class AopTest {

    @Test
    public void testAdvice() {
        ProxyFactory proxyFactory = new ProxyFactory();

        proxyFactory.setTarget(new UserServiceNoInterface());

        proxyFactory.addAdvice(new AopAspect());

        UserServiceNoInterface proxy = (UserServiceNoInterface) proxyFactory.getProxy();

        try {
            proxy.queryAllUser();

        }catch (Exception e){
            e.printStackTrace();

        }
    }
}
